package com.expressao;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.view.ScaleGestureDetector;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.Toast;
import br.com.util.Config;

import com.example.mobilefala.R;
import com.example.mobilefala.R.drawable;

public class TelaMenu extends Activity implements Runnable{

	public static int aba2;

	ProgressDialog dialogo ;
	public static boolean check;

	@SuppressLint("NewApi")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		Tts.checkIntent = new Intent();
		Tts.checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
		//new Thread(this).start();
		setContentView(R.layout.activity_tela_menu);
		ImageButton b = (ImageButton)findViewById(R.id.btIniciar);
		b.setImageResource(drawable.ic_action_play_over_video);
		
		b.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent it = new Intent(TelaMenu.this,Tts.class);
				startActivity(it);
				Tts.check = check;
			}
		});
				
		ImageButton bA = (ImageButton)findViewById(R.id.btAjuda);
		bA.setImageResource(drawable.ic_action_help);
		
		bA.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				
				//Toast.makeText(getApplication(), "Ajude-me", Toast.LENGTH_SHORT).show();
				
			}
		});
		
		ImageButton bConfig = (ImageButton)findViewById(R.id.btConfig);
	//	bA.setImageResource(drawable.ic_action_help);
		
		bConfig.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				
				Intent it = new Intent(TelaMenu.this,Config.class);
				startActivity(it);
			}
		});

		ImageButton bC = (ImageButton)findViewById(R.id.btContatos);
		bC.setImageResource(drawable.ic_action_email);
		
		bC.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent i = new Intent(Intent.ACTION_SEND);
				i.setType("message/rfc822");
				// i.setType("text/plain");
				i.putExtra(Intent.EXTRA_EMAIL,
						new String[] { "eltonss@ufpa.br" });
				i.putExtra(Intent.EXTRA_SUBJECT, "Contato sobre Mobile Fala");
				i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				i.putExtra(Intent.EXTRA_TEXT, "Corpo do Email");
				try {
					startActivity(Intent.createChooser(i, "Send mail..."));
				} catch (android.content.ActivityNotFoundException ex) {
					Toast.makeText(TelaMenu.this,
							"There are no email clients installed.",
							Toast.LENGTH_SHORT).show();
					
				}	
			}
		});
	}
	
	@Override
	public void run() {
//		Intent it = new Intent(TelaMenu.this,AddCategoria.class);
//		startActivity(it);
	}
}
